package main

import (
	"fmt"
	"net"
)

func main() {
	udpConn, err := net.ListenUDP("udp", &net.UDPAddr{
		IP:   net.IPv4(127, 0, 0, 1),
		Port: 20000,
	})
	if err != nil {
		fmt.Println(err)
		return
	}
	defer udpConn.Close()
	buf := make([]byte, 128)
	for {
		n, addr, err := udpConn.ReadFromUDP(buf)
		fmt.Println(n)
		if err != nil {
			fmt.Println(err)
			return
		}
		fmt.Println(string(buf))
		fmt.Println(addr)
	}
}
